package sivak.net.proc.dyn.tree_lib;



/**
 * Created with IntelliJ IDEA.
 * User: ZefiR
 * Date: 23.01.13
 * Time: 22:46
 * To change this template use File | Settings | File Templates.
 */
public class TreeNodeTest {
    public static void main(String[] args) {
        TreeNode treeNode = generateRes(3);
        System.out.println("Размер дерева - " + BinaryTreeUtils.size(treeNode));
        System.out.println("Высота дерева - " + BinaryTreeUtils.height(treeNode));
        System.out.println("Сумма элементов дерева - " + BinaryTreeUtils.sum(treeNode));
        System.out.println("Максимальный элемент дерева - " + BinaryTreeUtils.max(treeNode));
    }

    public static TreeNode generateRes(int k) {
        if (k < 2) {
            return new TreeNode(k, null, null);
        }
        return new TreeNode(generateRes(k - 2).value + generateRes(k - 1).value, generateRes(k - 2), generateRes(k - 1));
    }
}
